package encrypt

import (
	"encoding/base64"
	"golang.org/x/crypto/scrypt"
	"log"
)

func UseScrypt(password string) string {
	//返回字符串的长度
	const KeyLen = 10
	//盐值 是一个切片
	salt := make([]byte, 8)

	fpw, err := scrypt.Key([]byte(password), salt, 16384, 8, 1, KeyLen)
	if err != nil {
		log.Fatal(err)
	}
	return base64.StdEncoding.EncodeToString(fpw)
}
